#include<stdio.h>
#include<string.h>

int main()
{
	char a[50][50];
	int i=0,n;
	int p[11],q[11];
	while (gets(a[i])!=NULL)
	{
		memset(p,0,sizeof(p));
		memset(q,0,sizeof(q));
		if (strcmp(a[i],"exit")==0)
		{
			printf("End Of Input\n");
			break;
		}
		int len,j,flag=1;
		len=strlen(a[i]);
		for (j=0;j<len;j++)
			if (a[i][j]!=' '&&(a[i][j]<65||(a[i][j]>90&&a[i][j]<97)||a[i][j]>122))
				flag=0;
		if (flag==0)
		{
			printf("Input Error\n");
			continue;
		}
		int maxi=-1,num=0,begin=0,end=0,t=0;
		for (j=0;j<len;j++)
		{
			if (a[i][j]==' ')
			{
				begin=j+1;
				end++;
				num=0;
			}
			else
			{
				end++;
				num=end-begin;
			}
			if (maxi<num)
				maxi=num;
		}
		begin=0;
		end=0;
		num=0;
		for (j=0;j<len;j++)
		{
			if (a[i][j]==' ')
			{
				begin=j+1;
				end++;
				num=0;
			}
			else
			{
				end++;
				num=end-begin;
			}
			if (num==maxi)
			{
				t++;
				p[t]=begin;
				q[t]=end-1;
			}
		}
		int h;
		for (h=1;h<=t;h++)
		{
			for (j=p[h];j<=q[h];j++)
				printf("%c",a[i][j]);
			printf(",");
		}
		printf("\n");
		i++;
	}
	return 0;
}
